#include<iostream>
using namespace std;

int main()
{
	int a, b, c, d , e, f;
	cin >> a >> b >> c >> d;
	f = (c - a)*60 + d - b;
	e = f / 60;
	cout << e << " " << f%60 << endl;
	
	return 0;
}
